<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>职位搜索-高级搜索</title>
<link type="text/css" rel="stylesheet" href="css/searchJob.css" />
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="js/searchJob.js"></script>
   <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
   <script type="text/javascript">
      const constMess = sessionStorage.getItem("mess");

      $(document).ready(function () {

        /**
         * 判断从首页index.html搜索文本框传过来的数据是否有值，有值就进行待条件搜索
         */
             panduan(constMess);


         /**
          * 初始界面查询所有职位
          */

         // $.get("EnterpriceAndPosts/showAll",function (pos) {
         //    showBut(pos);
         //    show(pos.list);
         //
         // });

         /**
          * 带条件查询所有职位
          */
         $("[name='提交']").click(function () {
            var pname = $("[name='shuru']").val();
            $.get("EnterpriceAndPosts/showAll",{"pname":pname},function (pos) {
               showBut(pos);
               show(pos.list);
            });
         });
      });
      /**
       * 展示分页按钮
       */
      function showBut(pos) {
         $("#fenye").empty();
         for (var i = 0; i < pos.totalPages; i++) {
            $("   <a id='" + i + "' href=\"javascript:void(0)\" class=\"fy2 on\">" + (i + 1) + "</a>").appendTo("#fenye");
         }
      }
      /**
       * 判断从首页index.html搜索文本框传过来的数据是否有值，有值就进行待条件搜索
       */
      function panduan(constMess){
            $.get("EnterpriceAndPosts/showAll",{"pname":constMess},function (pos) {
               showBut(pos);
               show(pos.list);
            });

      }



      /**
       *为分页按钮绑定事件
       */
      $(document).on("click", ".fy2.on", function () {
         var page = $(this).text();
         $.get("EnterpriceAndPosts/showAll", {"page": page}, function (pos) {
            show(pos.list);
            showBut(pos);
         });
      });

      /**
       * 展示信息的通用方法
       * @param pos
       */
      function show(pos) {

         $("#xinxi").empty();
         for (var i = 0; i < pos.length; i++) {

            var $row = $("<tr>\n" +
                    "   <td>\n" +
                    "       <a name='ppname' href=\"job_info.html\" class=\"jobname\">" + pos[i].pname + "</a>\n" +
                    "   </td>\n" +
                    "   <td>\n" +
                    "       <div class=\"company\">\n" +
                    "           <a name='bbusiness' href=\"company.html\">" + pos[i].business + "</a>\n" +
                    "       </div>\n" +
                    "   </td>\n" +
                    "   <td></td>\n" +
                    "   <td>" + pos[i].fullAddress + "</td>\n" +
                    "   <td><span>" + pos[i].sal + "</span></td>\n" +
                    "   <td>" + pos[i].lastTime + "</td>\n" +
                    "</tr>\n" +
                    "<tr class=\"xxdetail none\">\n" +
                    "   <td colspan=\"5\">\n" +
                    "       <div class=\"yaoqiu\">学历要求：中专 | 工作经验：1~2年 | 公司规模：少于50人 | 招聘方式：全职<br/>\n" +
                    "           岗位职责：1、 负责公司资产管理、办公用品采购及劳保用品的管理工作,避免公司资产流失和浪费； 2、 负责书刊资料印刷、快递、物流及办公室的其他事情； 3、\n" +
                    "           ...<br/>\n" +
                    "           岗位要求：1、1年以上行政工作经验； 2、熟悉行政工作流程，办公用品采购流程，企业资产管理； 3、较强的责任心和敬业精神，良好的组织协调能力及沟通能力，较...\n" +
                    "       </div>\n" +
                    "   </td>\n" +
                    "   <td>\n" +
                    "       <div class=\"applydiv\">\n" +
                    "           <a href=\"javascript:void(0);\" class=\"ysqbtn\">已申请</a>\n" +
                    "           <span class=\"ygz\">已关注</span>\n" +
                    "       </div>\n" +
                    "   </td>\n" +
                    "</tr>");
            // 将生成的行添加到表格中
            $row.appendTo("#xinxi");
         }
      }

      /**
       *  为动态添加的元素绑定点击事件
       */

      $(document).on("click", "[name='ppname']", function () {
         const pname = $(this).text();  // 获取当前点击的职位名
         const business = $(this).closest('tr').find("[name='bbusiness']").text();  // 获取当前行中的公司名
         sessionStorage.setItem('pname', pname);
         sessionStorage.setItem('business', business);
      });
   </script>
</head>

<body>
<div class="topDiv">
  <div class="topL">
     <div class="logo">
        <a href="../../../../target/classes/public/index.html">
           <img src="images/LOGO.png" />
           <img src="images/view_logo40.png" class="img1"/>
        </a>
     </div>
     <img src="images/spirit_40.png" />
  </div>
  <div class="topR">
     <div class="topR0 topR2"><a href="register.html">注册</a></div>
     <div class="topR0 topR3"><a href="login.html">个人登录</a></div>
     <div class="clear"></div>
  </div>
</div>
<div class="menuDiv">
   <div class="mainWarp">
   </div>
</div>
<div class="clear"></div>
<div class="menuLittle">
</div>
<div class="clear"></div>
<div class="searchDiv">
  <div class="search1">
    <div class="sea1_1">
       <input name="shuru" type="text" placeholder="请填写关键词或选择职位" class="keyword"/>
       <span class="jiantou"></span>
    </div>
    <div class="sea1_4">
       <a name="提交" href="javascript:void(0)">搜工作</a>
    </div>
  </div>
</div>
<div class="clear"></div>
<div class="seachlist">
   <div class="listtop">
      <div class="tj1">
         <span class="list on">列表</span>
         <span class="zhaoyao">摘要</span>
      </div>
      <div class="tj3">
         <span>共1141条  第1/39页</span>
      </div>
   </div>
   <div class="clear"></div>
   <div class="listcon">
      <table border="0" width="100%" cellpadding="0" cellspacing="0" class="listtab">
         <thead>
           <tr>
              <th width="24%" style="padding-left:17px">职位名称</th>
              <th width="30%">企业名称</th>
              <th width="8%"></th>
              <th width="16%">工作地点</th>
              <th width="8%">薪水</th>
              <th width="10%">刷新时间</th>
           </tr>
         </thead>
         <tbody id="xinxi">

         </tbody>
      </table>
   </div>
   <div class="clear"></div>
   <div class="listbottom">
      <div class="lb3"><span>共1141条  第1/39页</span></div>
   </div>
   <div class="clear"></div>
   <div class="fenyediv">
      <div id="fenye">

      </div>
   </div>
   <div class="clear"></div>
</div>
<div class="clear"></div>
<div class="footer">
</div>
</body>
</html>
